<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="t_hire" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="gotoPage('/oa/humanresources/RecruitmentInformation?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 招聘信息 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="招聘标题" prop="">
              {{t_hire.hire_title}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="招聘岗位" prop="">
              {{t_hire.role}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="招聘人数" prop="">
              {{t_hire.hire_peonum}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="上岗时间" prop="">
              {{t_hire.hire_dedate}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 岗位要求 </span>
      </div>
      <el-table :data="s_duty">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_duty('&CMIDduty_id='+scope.row.duty_id+'')">删除</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="popUpJobRequirement('&CMIDduty_id='+scope.row.duty_id+'')">修改</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="名称" prop="duty_name">
        </el-table-column>
      </el-table>
      <el-button @click="popChoiceJobRequirement('')" type='primary' size="mini">选择</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 职责要求 </span>
      </div>
      <el-table :data="s_jobduty">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_jobduty('&CMIDjobduty_id='+scope.row.jobduty_id+'')">删除</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="popUpResponsibilities('&CMIDjobduty_id='+scope.row.jobduty_id+'')">修改</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="名称" prop="jobduty_name">
        </el-table-column>
      </el-table>
      <el-button @click="popChoiceResponsibilities('')" type='primary' size="mini">选择</el-button>
    </el-form>
    <el-dialog :visible.sync="UpJobRequirementVisible" append-to-body>
      <UpJobRequirement v-if="UpJobRequirementVisible" ref="UpJobRequirement" :popparams="popparams"> </UpJobRequirement>
    </el-dialog>
    <el-dialog :visible.sync="ChoiceJobRequirementVisible" append-to-body>
      <ChoiceJobRequirement v-if="ChoiceJobRequirementVisible" ref="ChoiceJobRequirement" :popparams="popparams"> </ChoiceJobRequirement>
    </el-dialog>
    <el-dialog :visible.sync="UpResponsibilitiesVisible" append-to-body>
      <UpResponsibilities v-if="UpResponsibilitiesVisible" ref="UpResponsibilities" :popparams="popparams"> </UpResponsibilities>
    </el-dialog>
    <el-dialog :visible.sync="ChoiceResponsibilitiesVisible" append-to-body>
      <ChoiceResponsibilities v-if="ChoiceResponsibilitiesVisible" ref="ChoiceResponsibilities" :popparams="popparams"> </ChoiceResponsibilities>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import UpJobRequirement from "@/views/oa/humanresources/UpJobRequirement";
  import ChoiceJobRequirement from "@/views/oa/humanresources/ChoiceJobRequirement";
  import UpResponsibilities from "@/views/oa/humanresources/UpResponsibilities";
  import ChoiceResponsibilities from "@/views/oa/humanresources/ChoiceResponsibilities";
  export default {
    name: 'DetsRecruitment',
    components: {
      UpJobRequirement,
      ChoiceJobRequirement,
      UpResponsibilities,
      ChoiceResponsibilities,
    },
    props: ['popparams'],
    data() {
      return {
        UpJobRequirementVisible: false,
        UpJobRequirementValue: null,
        UpJobRequirementDesc: null,
        ChoiceJobRequirementVisible: false,
        ChoiceJobRequirementValue: null,
        ChoiceJobRequirementDesc: null,
        UpResponsibilitiesVisible: false,
        UpResponsibilitiesValue: null,
        UpResponsibilitiesDesc: null,
        ChoiceResponsibilitiesVisible: false,
        ChoiceResponsibilitiesValue: null,
        ChoiceResponsibilitiesDesc: null,
        vueparams: this.getVUEParams(""),
        t_hire: {
          hire_title: null,
          role: null,
          hire_peonum: null,
          hire_dedate: null,
        },
        s_duty: [],
        s_jobduty: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/oa/humanresources/InterviewInfoAction/detsRecruitment?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_duty(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/oa/humanresources/InterviewInfoAction/d_duty?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      d_jobduty(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/oa/humanresources/InterviewInfoAction/d_jobduty?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popUpJobRequirement(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.UpJobRequirementVisible = !this.UpJobRequirementVisible;
      },
      popChoiceJobRequirement(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ChoiceJobRequirementVisible = !this.ChoiceJobRequirementVisible;
      },
      popUpResponsibilities(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.UpResponsibilitiesVisible = !this.UpResponsibilitiesVisible;
      },
      popChoiceResponsibilities(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ChoiceResponsibilitiesVisible = !this.ChoiceResponsibilitiesVisible;
      },
    },
  }
</script>
